package com.white.databasesbackup.expand;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.function.Supplier;

/**
 * <p>
 * 有事务的方式执行
 * </p>
 *
 * @author huangzy
 * @since 2022/5/6
 */
@Component
public class SupplierTransactionalSupported {

    @Transactional(rollbackFor = Throwable.class)
    public <R> R  run(Supplier<R> supplier) {
        return supplier.get();
    }
}
